How to join 2 tables with multiple conditions each

visit shbcf.ru